//
// Written by Motti Shaked
//
// motti@wincode.net
//
// Version: 1.0.0.0
//
// DISCLAIMER:
//
// You may use this code as you please.
// You may modify and share it freely.
// You may NOT hold me liable for any damage
// caused to you, your company, your neighbors,
// or anyone else as a result of using this code,
// taking ideas from it, dreaming of it,
// or any other use you may find it suitable for.
// Whatever you do with this code is at 
// your own risk.
//
// Enjoy!
// 

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Serialization;

namespace Universe.Remoting.Sinks
{
    [Serializable]
    public class CustomSinkException : RemotingException
    {
        public CustomSinkException()
        {
        }

        public CustomSinkException(string message) : base(message)
        {
        }

        protected CustomSinkException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }

        public CustomSinkException(string message, System.Exception innerException)
            : base(message, innerException)
        {
        }
    }

    public class ExcludeMeException : System.Exception
    {
        private bool excludeMePermanently = false;

        public ExcludeMeException()
        {
        }

        public ExcludeMeException(bool excludeMePermanently)
        {
            this.excludeMePermanently = excludeMePermanently;
        }

        public bool ExcludeMePermanently
        {
            get {return this.excludeMePermanently;}
        }
    }

    public class SinkCreationData
    {
        public SinkCreationData(SinkProviderData configurationData)
        {
            this.ConfigurationData = configurationData;
        }

        public readonly SinkProviderData ConfigurationData;
    }

    public class ClientSinkCreationData : SinkCreationData
    {
        public ClientSinkCreationData(SinkProviderData configurationData, IChannelSender channel, string url, object remoteChannelData)
            : base(configurationData)
        {
            this.Channel = channel;
            this.Url = url;
            this.RemoteChannelData = remoteChannelData;
        }

        public readonly IChannelSender Channel;
        public readonly string Url;
        public readonly object RemoteChannelData;
    }

    public class ServerSinkCreationData : SinkCreationData
    {
        public ServerSinkCreationData(SinkProviderData configurationData, IChannelReceiver channel)
            : base(configurationData)
        {
            this.Channel = channel;
        }

        public readonly IChannelReceiver Channel;
    }
}